package com.shiguiwu.springmybatis.algorithm.queue;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.ArrayBlockingQueue;

/**
 * @description: java的阻塞队列
 * @author: stone
 * @date: Created by 2022/5/15 16:55
 * @version: 1.0.0
 * @pakeage: com.shiguiwu.springmybatis.algorithm.queue
 */
@Slf4j
public class JdkQueueTests {


    public static void main(String[] args) throws Exception {

        ArrayBlockingQueue<Integer> queue = new ArrayBlockingQueue<>(10);

        queue.put(1);
        queue.add(2);
        queue.offer(3);

        log.info("取元素 == > {}", queue.peek());
        log.info("取元素 == > {}", queue.take());
        log.info("取元素 == > {}", queue.poll());

    }
}
